package cn.anecansaitin.whimsy.common.item;

import cn.anecansaitin.whimsy.Whimsy;
import cn.anecansaitin.whimsy.common.entity.PhantasmArrow;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class PhantasmArrowItem extends ArrowItem {
    private final Component component1 = Component.translatable("tooltip." + Whimsy.MODID + ".phantasm_arrow_item.1").withStyle(ChatFormatting.AQUA);
    private final Component component2 = Component.translatable("tooltip." + Whimsy.MODID + ".phantasm_arrow_item.2").withStyle(ChatFormatting.GOLD);

    public PhantasmArrowItem() {
        super(new Properties());
    }

    @Override
    public AbstractArrow createArrow(Level level, ItemStack stack, LivingEntity shooter) {
        return new PhantasmArrow(shooter);
    }

    @Override
    public boolean isInfinite(ItemStack stack, ItemStack bow, Player player) {
        return false;
    }

    @Override
    public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltips, TooltipFlag isAdvanced) {
        tooltips.add(component1);
        tooltips.add(component2);
    }

    @Override
    public boolean isFireResistant() {
        return true;
    }
}
